+Wed Jul 7 23:53:58 2004 Matthias Clasen <maclas@gmx.de>
+
+ * gdk-pixbuf-io.h:
+ * gdk-pixbuf-io.c (gdk_pixbuf_format_is_disabled):
+ * gdk-pixbuf-io.c (gdk_pixbuf_format_set_disabled):
+ * gdk-pixbuf-io.c (gdk_pixbuf_format_get_license):
+ New functions to disable/enable individual loaders and to
+ obtain license information about loaders.
+
+ * gdk-pixbuf-io.h (GdkPixbufFormat): Add disabled and
+ license fields.
+
+ * gdk-pixbuf-io.c (_gdk_pixbuf_get_module):
+ * gdk-pixbuf-io.c (_gdk_pixbuf_get_named_module): Skip
+ disabled loaders.
+
+ * io-*.c: Add license information in the fill_info
+ functions.
+
2004-07-07 Matthias Clasen <mclasen@redhat.com>
* gdk-pixbuf-features.h.in: Fix the build.
for (modules = get_file_formats (); modules; modules = g_slist_next (modules)) {
GdkPixbufModule *module = (GdkPixbufModule *)modules->data;
+
+ if (module->info->disabled)
+ continue;
+
if (!strcmp (name, module->module_name))
return module;
}
for (modules = get_file_formats (); modules; modules = g_slist_next (modules)) {
GdkPixbufModule *module = (GdkPixbufModule *)modules->data;
+
+ if (module->info->disabled)
+ continue;
+
score = format_check (module, buffer, size);
if (score > best) {
best = score;
return (format->flags & GDK_PIXBUF_FORMAT_SCALABLE) != 0;
}
+/**
+ * gdk_pixbuf_format_is_disabled:
+ * @format: a #GdkPixbufFormat
+ *
+ * Returns whether this image format is disabled. See
+ * gdk_pixbuf_format_set_disabled().
+ *
+ * Return value: whether this image format is disabled.
+ *
+ * Since: 2.6
+ */
+gboolean
+gdk_pixbuf_format_is_disabled (GdkPixbufFormat *format)
+{
+ g_return_val_if_fail (format != NULL, FALSE);
+
+ return format->disabled;
+}
+
+/**
+ * gdk_pixbuf_format_set_disabled:
+ * @format: a #GdkPixbufFormat
+ * @disabled: %TRUE to disable the format @format
+ *
+ * Disables or enables an image format. If a format is disabled,
+ * gdk-pixbuf won't use the image loader for this format to load
+ * images. Applications can use this to avoid using image loaders
+ * with an inappropriate license, see gdk_pixbuf_format_get_license().
+ *
+ * Since: 2.6
+ */
+void
+gdk_pixbuf_format_set_disabled (GdkPixbufFormat *format,
+ gboolean disabled)
+{
+ g_return_val_if_fail (format != NULL, FALSE);
+
+ format->disabled = disabled != FALSE;
+}
+
+/**
+ * gdk_pixbuf_format_get_license:
+ * @format: a #GdkPixbufFormat
+ *
+ * Returns information about the license of the image loader
+ * for the format. The returned string should be a shorthand for
+ * a wellknown license, e.g. "LGPL", "GPL", "QPL", "GPL/QPL",
+ * or "other" to indicate some other license.
+ *
+ * Returns: a string describing the license of @format.
+ *
+ * Since: 2.6
+ */
+gchar*
+gdk_pixbuf_format_get_license (GdkPixbufFormat *format)
+{
+ g_return_val_if_fail (format != NULL, FALSE);
+
+ return g_strdup (format->license);
+}
+
GdkPixbufFormat *
_gdk_pixbuf_get_format (GdkPixbufModule *module)
{
typedef struct _GdkPixbufFormat GdkPixbufFormat;
-GSList *gdk_pixbuf_get_formats (void);
+GSList *gdk_pixbuf_get_formats (void);
gchar *gdk_pixbuf_format_get_name (GdkPixbufFormat *format);
gchar *gdk_pixbuf_format_get_description (GdkPixbufFormat *format);
gchar **gdk_pixbuf_format_get_mime_types (GdkPixbufFormat *format);
gchar **gdk_pixbuf_format_get_extensions (GdkPixbufFormat *format);
gboolean gdk_pixbuf_format_is_writable (GdkPixbufFormat *format);
gboolean gdk_pixbuf_format_is_scalable (GdkPixbufFormat *format);
+gboolean gdk_pixbuf_format_is_disabled (GdkPixbufFormat *format);
+void gdk_pixbuf_format_set_disabled (GdkPixbufFormat *format,
+ gboolean disabled);
+gchar *gdk_pixbuf_format_get_license (GdkPixbufFormat *format);
-GdkPixbufFormat *gdk_pixbuf_get_file_info (const gchar *filename,
- gint *width,
- gint *height);
+GdkPixbufFormat *gdk_pixbuf_get_file_info (const gchar *filename,
+ gint *width,
+ gint *height);
#ifdef GDK_PIXBUF_ENABLE_BACKEND
gchar **mime_types;
gchar **extensions;
guint32 flags;
+ gboolean disabled;
+ gchar *license;
};
info->mime_types = mime_types;
info->extensions = extensions;
info->flags = 0;
+ info->license = "LGPL";
}
info->mime_types = mime_types;
info->extensions = extensions;
info->flags = 0;
+ info->license = "LGPL";
}
info->mime_types = mime_types;
info->extensions = extensions;
info->flags = 0;
+ info->license = "LGPL";
}
info->mime_types = mime_types;
info->extensions = extensions;
info->flags = GDK_PIXBUF_FORMAT_WRITABLE;
+ info->license = "LGPL";
}
info->mime_types = mime_types;
info->extensions = extensions;
info->flags = GDK_PIXBUF_FORMAT_WRITABLE;
+ info->license = "LGPL";
}
info->mime_types = mime_types;
info->extensions = extensions;
info->flags = 0;
+ info->license = "LGPL";
}
info->mime_types = mime_types;
info->extensions = extensions;
info->flags = GDK_PIXBUF_FORMAT_WRITABLE;
+ info->license = "LGPL";
}
info->mime_types = mime_types;
info->extensions = extensions;
info->flags = 0;
+ info->license = "LGPL";
}
info->mime_types = mime_types;
info->extensions = extensions;
info->flags = 0;
+ info->license = "LGPL";
}
info->mime_types = mime_types;
info->extensions = extensions;
info->flags = 0;
+ info->license = "LGPL";
}
info->mime_types = mime_types;
info->extensions = extensions;
info->flags = 0;
+ info->license = "LGPL";
}
info->mime_types = mime_types;
info->extensions = extensions;
info->flags = 0;
+ info->license = "LGPL";
}
info->mime_types = mime_types;
info->extensions = extensions;
info->flags = 0;
+ info->license = "LGPL";
}
info->mime_types = mime_types;
info->extensions = extensions;
info->flags = 0;
+ info->license = "LGPL";
}